package main

import (
	"awesomeProject/core"
	"awesomeProject/global"
	"awesomeProject/initialize"
	"context"
)

func main() {
	initialize.ViperInit()
	global.Gorm = initialize.GormInit()
	global.RedisClient = initialize.RedisInit()
	global.MongoDB = initialize.MongoDBInit()
	// global.ZapLogger = .Zap()       // 初始化zap日志库
	if global.Gorm != nil {
		// 程序结束前关闭数据库链接
		db, _ := global.Gorm.DB()
		defer db.Close()
		defer global.RedisClient.Close()
		defer global.MongoDB.Client().Disconnect(context.TODO())
	}

	core.RunServer()
}
